package com.bsoft.gol.hcs.clinical.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import ctd.util.annotation.RpcService;
import hcn.base.CheckRequisitionDetail;

import java.math.BigDecimal;
import java.util.List;

public abstract class CheckRequisitionDetailDAO extends HibernateSupportDelegateDAO<CheckRequisitionDetail> {
    /**
     * 获取检验明细
     *
     * @param checkRequisitionRecordId
     * @return
     */
    @RpcService
    @DAOMethod(sql = " from CheckRequisitionDetail where checkRequisitionRecordId =:checkRequisitionRecordId ")
    public abstract List<CheckRequisitionDetail> findCheckRequisitionDetail(@DAOParam("checkRequisitionRecordId") String checkRequisitionRecordId);

    @RpcService
    @DAOMethod(sql = "delete from CheckRequisitionDetail where checkRequisitionDetailId=:checkRequisitionDetailId")
    public abstract void deleteCheckRequisitionDetail(@DAOParam(value = "checkRequisitionDetailId") String checkRequisitionDetailId);

    @RpcService
    @DAOMethod(sql = "delete from CheckRequisitionDetail where checkRequisitionRecordId=:checkRequisitionRecordId")
    public abstract void deleteCheckRequisitionDetailByRecordId(@DAOParam(value = "checkRequisitionRecordId") String checkRequisitionRecordId);

    @RpcService
    @DAOMethod(sql = " update CheckRequisitionDetail set amount=:amount,price=:price," +
            "itemId=:itemId,itemName=:itemName,expenseDetailId=:expenseDetailId" +
            " where checkRequisitionRecordId=:id")
    public abstract void updateExpense(@DAOParam(value = "id")String id, @DAOParam(value = "amount")BigDecimal amount,
                                       @DAOParam(value = "price")BigDecimal price, @DAOParam(value = "itemId")String itemId,
                                       @DAOParam(value = "itemName")String itemName, @DAOParam(value = "expenseDetailId")String expenseDetailId);

    @RpcService
    @DAOMethod(sql = "delete from CheckRequisitionDetail where checkRequisitionRecordId=:checkRequisitionRecordId and examMajorItemId=:examMajorItemId")
    public abstract void deleteCheckRequisitionDetailByExamMajorItemId(@DAOParam(value = "checkRequisitionRecordId") String checkRequisitionRecordId, @DAOParam(value = "examMajorItemId") String examMajorItemId);

}
